<template>
    <div class="createPost-container">
        <el-form ref="postForm" :model="postForm" class="form-container">
            <div class="createPost-main-container" style="margin-top: 20px;">

                <el-form-item label="用户名" prop="username" label-width="90px" class="postInfo-container-item">
                    {{postForm.username}}
                </el-form-item>

                <el-form-item label="手机号" prop="mobile" label-width="90px" class="postInfo-container-item">
                    {{postForm.mobile}}
                </el-form-item>

                <el-form-item label="邮箱" prop="email" label-width="90px" class="postInfo-container-item">
                    {{postForm.email}}
                </el-form-item>

                <el-form-item label-width="90px" label="类型" class="postInfo-container-item">
                    {{ postForm.user_type==1?'管理员':'普通用户' }}
                </el-form-item>

                <el-form-item label-width="90px">
                    <el-button type="success" @click="edit">修改</el-button>
                </el-form-item>

            </div>
        </el-form>
    </div>
</template>

<script>

    export default {
        name: 'profile',
        data() {
            return {
                postForm: null,
                typeOptions: [{type:"1", lable:"管理员"}, {type:"2", lable:"普通用户"}],
            }
        },
        created() {
            this.fetchData()
        },
        methods: {
            fetchData() {
                this.$adminApi.auth_me().then(response => {
                    this.postForm = response.data
                }).catch(err => {
                    console.log(err)
                })
            },
            edit() {
                this.$router.push({
                    name: 'userUpdate',
                    params: {  }
                })
            },

        }
    }
</script>
